package com.uphone.kingmall.activity.personal.set;

import android.widget.EditText;
import android.widget.LinearLayout;

import com.china.zhuoyue.R;
import com.lzy.okgo.model.HttpParams;
import com.uphone.kingmall.base.BaseActivity;
import com.uphone.kingmall.utils.CommonUtil;
import com.uphone.kingmall.utils.HttpParamsUtils;
import com.uphone.kingmall.utils.MyUrl;
import com.uphone.kingmall.view.SubmitButton;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * <pre>
 *     author : radish
 *     e-mail : 15703379121@163.com
 *     time   : 2019/3/21
 *     desc   :
 * </pre>
 */
public class ModifyPayPwdSetActivty extends BaseActivity {
    @BindView(R.id.et_pwd)
    EditText etPwd;
    @BindView(R.id.btn_submit)
    SubmitButton btnSubmit;
    @BindView(R.id.et_pwd_confirm)
    EditText etPwdConfirm;
    @BindView(R.id.ll)
    LinearLayout ll;

    @Override
    public int getLayoutContentId() {
        return R.layout.kingmall_activity_pay_pwd_set;
    }

    @Override
    public void initView() {
        btnSubmit.setRelaViews(etPwd, etPwdConfirm);
        CommonUtil.initTitle(this, "设置支付密码", ll);
    }

    @Override
    public void initData() {

    }

    @OnClick(R.id.btn_submit)
    public void onViewClicked() {
        if (CommonUtil.checkViewEmpty("请输入支付密码", etPwd)) {
            return;
        }
        if (!etPwd.getText().toString().trim().equals(etPwdConfirm.getText().toString().trim())) {
            showShortToast("两次密码不一致");
            return;
        }
        HttpParams params = HttpParamsUtils.getInstance().put("payPass", etPwd.getText().toString().trim()).getParams();
        CommonUtil.submitNetAndFinish(this, MyUrl.setPayPass, params, "设置成功!");
    }
}
